<?php

namespace Modules\Admin\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UserRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {	$id=$this->route('user');
        return [
            'name'=>'required|unique:users,name,'.$id,
			'email'=>'required|unique:users,email,'.$id,
			'password'=>'nullable|between:6,20'
        ];
    }
	public function messages ()
	{
		return [
			'name.required'=>'商户名称必填',
			'email.required'=>'邮箱必须填写',
			'name.unique'=>'商户名称已存在',
			'email.unique'=>'邮箱已存在',
			'password.between'=>'密码长度在6-20位之间'
		];
	}

	/**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
}
